package autoevony.scripts 
{
    import autoevony.common.*;
    import autoevony.player.*;
    
    public class ScriptParams extends Object
    {
        public function ScriptParams(arg1:String, arg2:Function, arg3:Array, arg4:Array, arg5:int)
        {
            var loc1:*=null;
            super();
            this.func = arg2;
            this.funcName = arg1;
            this.params = arg3;
            this.paramTypes = arg4;
            this.nParamsRequired = arg5;
            if (!(arg3.length == arg4.length) || arg4.length < arg5) 
            {
                throw new Error("FATAL ERROR: Invalid param number in Script Prototype for " + arg1);
            }
            var loc2:*=0;
            var loc3:*=arg4;
            for each (loc1 in loc3) 
            {
                if (TYPENAMES.indexOf(loc1) != -1) 
                {
                    continue;
                }
                throw new Error(irrcrpt("IDWDO HUURU: Lqydolg sdudp wbsh lq Vfulsw Surwrwbsh iru ", 3) + arg1);
            }
            return;
        }

        public function _ih1004():String
        {
            var loc1:*=funcName;
            var loc2:*=0;
            while (loc2 < params.length) 
            {
                if (loc2 >= nParamsRequired) 
                {
                    loc1 = loc1 + irrcrpt(" [", 5) + params[loc2] + "]";
                }
                else 
                {
                    loc1 = loc1 + " " + params[loc2];
                }
                ++loc2;
            }
            return loc1;
        }

        internal function _oy596(arg1:String, arg2:String):Boolean
        {
            if (!(arg2.indexOf("%") == -1) || !(arg2.indexOf("{") == -1) || !(arg2.indexOf("$") == -1)) 
            {
                return true;
            }
            if (arg1 == irrcrpt("Vwulqj", 3)) 
            {
                return true;
            }
            if (arg1 == "Boolean") 
            {
                return arg2 == irrcrpt("xvyi", 4) || arg2 == irrcrpt("gbmtf", 1);
            }
            if (arg1 == irrcrpt("Ryqfiv", 4)) 
            {
                return autoevony.common.Utils._oi187(arg2);
            }
            if (arg1 == irrcrpt("kpv", 2)) 
            {
                return autoevony.common.Utils._oi187(arg2) && int(arg2) == Number(arg2);
            }
            if (arg1 == irrcrpt("Dppsejobuf", 1)) 
            {
                return !(autoevony.player.Map._fs482(arg2) == -1);
            }
            if (arg1 == irrcrpt("Uhvrxufh", 3)) 
            {
                return arg2 == irrcrpt("pqpg", 2) || !(autoevony.common.Utils._ph1199(arg2) == null);
            }
            if (arg1 == "Fortification") 
            {
                return arg2 == irrcrpt("stsj", 5) || !(autoevony.common.Utils._xw989(arg2) == null);
            }
            if (arg1 == irrcrpt("Vtqqr", 2)) 
            {
                return arg2 == irrcrpt("stsj", 5) || !(autoevony.common.Utils._ts1269(arg2) == null);
            }
            throw new Error(irrcrpt("KFYFQ JWWTW: Nsafqni Xhwnuy Uwtytyduj ktw ", 5) + funcName + irrcrpt(", mrzepmh xcti: ", 4) + arg1);
        }

        public function _ex787():String
        {
            var loc1:*=_ih1004();
            var loc2:*=0;
            while (loc2 < params.length) 
            {
                loc1 = loc1 + irrcrpt("\n  ", 3) + params[loc2] + irrcrpt(" lv ri wbsh ", 3) + paramTypes[loc2];
                ++loc2;
            }
            return loc1;
        }

        public function _pi216(arg1:Array):Array
        {
            if (_ni178(arg1) != null) 
            {
                return null;
            }
            var loc1:*=new Array();
            var loc2:*=0;
            while (loc2 < arg1.length) 
            {
                loc1.push(getValue(paramTypes[loc2], arg1[loc2]));
                ++loc2;
            }
            return loc1;
        }

        public function _ni178(arg1:Array):String
        {
            if (arg1.length < nParamsRequired) 
            {
                if (paramTypes.length == nParamsRequired) 
                {
                    return irrcrpt("Rsx irsykl teveqw, ", 4) + nParamsRequired + irrcrpt(" evi viuymvih\nYweki: ", 4) + _ih1004();
                }
                return irrcrpt("Qrw hqrxjk sdudpv, dw ohdvw ", 3) + nParamsRequired + " are required\iUsage: " + _ih1004();
            }
            if (arg1.length > params.length) 
            {
                return irrcrpt("Upp nboz qbsbnt, vtbhf: ", 1) + _ih1004();
            }
            var loc1:*=0;
            while (loc1 < arg1.length) 
            {
                if (!_oy596(paramTypes[loc1], arg1[loc1])) 
                {
                    return irrcrpt("Nsafqni afqzj ", 5) + arg1[loc1] + irrcrpt(" gps qbsbn ", 1) + params[loc1] + irrcrpt("(yduj ", 5) + paramTypes[loc1] + irrcrpt(")\nVtbhf: ", 1) + _ih1004();
                }
                ++loc1;
            }
            return null;
        }

        public static function getValue(arg1:String, arg2:String):Object
        {
            if (arg1 == irrcrpt("Tusjoh", 1)) 
            {
                return arg2;
            }
            if (arg1 == irrcrpt("Errohdq", 3)) 
            {
                return arg2 == irrcrpt("vtwg", 2);
            }
            if (arg1 == irrcrpt("Httwinsfyj", 5)) 
            {
                return autoevony.player.Map._fs482(arg2);
            }
            if (arg1 == irrcrpt("Pwodgt", 2)) 
            {
                return Number(arg2);
            }
            if (arg1 == irrcrpt("nsy", 5)) 
            {
                return int(arg2);
            }
            if (arg1 == irrcrpt("Sftpvsdf", 1)) 
            {
                return arg2 != irrcrpt("rsri", 4) ? autoevony.common.Utils._ph1199(arg2) : null;
            }
            if (arg1 == irrcrpt("Hqtvkhkecvkqp", 2)) 
            {
                return arg2 != irrcrpt("opof", 1) ? autoevony.common.Utils._xw989(arg2) : null;
            }
            if (arg1 == irrcrpt("Usppq", 1)) 
            {
                return arg2 != irrcrpt("opof", 1) ? autoevony.common.Utils._ts1269(arg2) : null;
            }
            throw new Error("FATAL ERROR: Unexpected call to getValue in Script Prototype");
        }

        
        {
            TYPENAMES = new Array(irrcrpt("Tusjoh", 1), irrcrpt("Gttqjfs", 5), irrcrpt("Szrgjw", 5), irrcrpt("kpv", 2), irrcrpt("Httwinsfyj", 5), irrcrpt("Viwsyvgi", 4), irrcrpt("Ktwynknhfynts", 5), irrcrpt("Usppq", 1));
        }

        public var func:Function;

        internal var params:Array;

        internal var paramTypes:Array;

        public var funcName:String;

        internal var nParamsRequired:int;

        internal static var TYPENAMES:Array;
    }
}
